<h2>Search</h2>

<?php echo  form_tag('index',array('method'=>'get')) ?>

<?php echo  text_field_tag('query',$_GET['query']) ?>

<?php echo  submit_tag('Search') ?>

<?php echo  end_form_tag() ?>

<hr />

<?php
if($results_pager) 
{
    $results_parts    = $results_pager->RenderParts(10);
    $header           = $results_parts['header'];
    $footer           = $results_parts['footer'];
    $record_count     = $results_parts['record_count'];
    $results          = $results_parts['grid'];
    $the_search_query = htmlentities($_GET['query']);
    if ( $record_count > 0 )
    {
        echo content_tag('h3', "$record_count result".( ($record_count !=1) ? 's' : '' )." for $the_search_query");
        echo "<ol>";
        foreach( $results as $result )
        {
            printf("<li><h4>%s</h4><p>%s</p></li>",
                link_to($result['title'],$result['url']),
                search_context($result['content'], $the_search_query)
            );
        }
        echo "</ol>";
        echo "<p>$footer $header</p>";
    } else {
        echo "<p>No Results.</p>";
    }
}
?>